//
//  NIPhotoSelectionView.h
//  NewIdeasAPI_Base
//  图片选择,九宫格选择
//  Created by 　罗若文 on 16/6/15.
//  Copyright © 2016年 罗若文. All rights reserved.
//

#import <UIKit/UIKit.h>

///回调
typedef void (^NIPhotoSelectionBlock)(id PhotoSelectionView);
typedef void (^NIPhotoSelectionClickBlock)(id PhotoSelectionView,UIImage * photo);
typedef void (^NIPhotoSelectionOtherBtnBlock)(id PhotoSelectionView,UIImage * photo,NSString * otherAction);

@interface NIPhotoSelectionView : UIView

///选中得图片列表UIImage的Base64编码字符串列表
@property (nonatomic,strong) NSMutableArray * PhotoBase64List;

///选中得图片列表(UIImage)
@property (nonatomic,strong) NSMutableArray * listPhoto;

///是否剪裁 默认是不剪裁
@property (nonatomic) BOOL allowsEditing;

/// 3x3 九宫格图片添加视图 (大小(高度会随图片多少而变化),每个视图大小,视图更新(用来动态修改容器大小),视图点击)
- (instancetype)initWithFrame:(CGRect)frame everyViewSize:(CGSize)everyViewSize refreshBlock:(NIPhotoSelectionBlock)refreshBlock photoClickBlock:(NIPhotoSelectionClickBlock)photoClickBlock;

/// 3x3 九宫格图片添加视图 (大小(高度会随图片多少而变化),每个视图大小,视图样式,视图更新(用来动态修改容器大小),视图点击)
- (instancetype)initWithFrame:(CGRect)frame everyViewSize:(CGSize)everyViewSize plistStyleKey:(id)plistStyleKey refreshBlock:(NIPhotoSelectionBlock)refreshBlock photoClickBlock:(NIPhotoSelectionClickBlock)photoClickBlock;

///初始化视图
///(视图大小(高度会随图片多少而变化),每个图片按钮的大小,图片按钮的样式,每行几列,总共几个,添加按钮的图片,视图改变的时候触发,点击图片按钮的时候触发(photoClickBlock)为nil的时候是替换图片)
- (instancetype)initWithFrame:(CGRect)frame everyViewSize:(CGSize)everyViewSize plistStyleKey:(id)plistStyleKey row:(int)row photoCount:(int)photoCount defaultImg:(UIImage *)defaultImg refreshBlock:(NIPhotoSelectionBlock)refreshBlock photoClickBlock:(NIPhotoSelectionClickBlock)photoClickBlock;

///打开相册/相机/删除/其他按钮(otherActions和otherBlock要同时存在) 至少一个,不然无效
-(void)openAlbum:(BOOL)Album Camera:(BOOL)Camera deletePic:(BOOL)deletePic otherActions:(NSArray *)otherActionTitles otherBlock:(NIPhotoSelectionOtherBtnBlock)otherBlock;

///追加图片,按空余的位置顺序添加进去,多余的不会添加 list<UIImage>
-(void)addToPhotos:(NSArray *)photos;

///删除第几张图片
-(void)deletePhoto:(int)index;

@end
